package com.platform.enums;

import com.platform.comm.constants.EnumOption;
import com.platform.comm.enums.IDictEntry;
import com.platform.comm.enums.IEnumItem;
import com.platform.comm.enums.IEnumOption;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zq
 */
@EnumOption(name = "dbpBussLogDealResult")
public enum DbpBussLogDealResult implements IDictEntry, IEnumItem, IEnumOption<String> {

    /**
     * 核实无误
     */
    APPROVE_END("APPROVE_END","初审完成"),
    /**
     * 核实无误
     */
    NO("NO","核实无误"),

    /**
     * 取消公示
     */
    CA("CA","取消公示"),

    /**
     * 删除信息
     */
    DE("DE","删除信息"),

    /**
     * 更新信息
     */
    UP("UP","更新信息"),
    /**
     * 未更新
     */
    DIS_UP("DIS_UP","未更新"),


    // 信用修复
    APPLY("APPLY", "申请修复"),
    PASS("PASS", "同意修复"),
    REJECT("REJECT", "拒绝修复"),

    // 批量修复

//    repaired("1", "已修复")
    ;

    private final String key;
    private final String title;

    DbpBussLogDealResult(String key, String title) {
        this.key = key;
        this.title = title;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public String getValue() {
        return this.title;
    }

    @Override
    public Object getData() {
        return this;
    }

    @Override
    public boolean is(String code) {
        return this.name().equals(code);
    }

    /**
     * 枚举项 “键”
     *
     * @return key 键
     */
    @Override
    public String key() {
        return name();
    }

    /**
     * 枚举项 “值”
     *
     * @return value 值
     */
    @Override
    public String value() {
        return title;
    }

    /**
     * 枚举options
     *
     * @return 枚举项组成的map
     */
    @Override
    public Map<String, String> enums() {
        return Arrays.stream(values()).collect(Collectors.toMap(IEnumOption::key, IEnumOption::value));
    }
}
